package regAlloc;

import java.util.Set;


public class TempNode {
        public TempNode(temp.Temp v) {
                value = v;
        }
        private temp.Temp value;
        private Set<TempNode> edges;            
        public temp.Temp getValue() {
                return value;
        }
        
        public void addEdge(TempNode t) {
                edges.add(t);
        }
        
        @Override
        public boolean equals(Object o) {
                if(o == null) return false;
                TempNode n = (TempNode)o;
                return n.getValue() == this.getValue();
        }
        
        @Override
        public String toString() {
                StringBuffer sb = new StringBuffer();
                sb.append("Temp : ");
                sb.append(value.print());
                sb.append("\nEDGES\n");
                for(TempNode t : edges) {
                        sb.append("\t->");
                        sb.append(t.value.print());
                }
                sb.append("----\t----\t----\n");
                return sb.toString();
        }
}